//<template>
    <div>
        <div>
            <tr>
                <td>用户</td>
                <td>vip</td>
            </tr>
            <tr v-for="i in order_list" :key="i.id">
                <td>{{i.name}}</td>
                <td><button @click="userPut(i.id)">升级</button></td>
            </tr>
        </div>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            order_list:[],
            id:sessionStorage.getItem('user_id'),
            url:'http://127.0.0.1:8000'
        }
    },
    methods:{
        orderShow(){
            axios({
                url:'http://127.0.0.1:8000/workapp/user_show/',
            }).then(res=>{
                this.order_list = res.data
            })
        },
        userPut(id){
            let form_data = new FormData()
            form_data.append('id',id)
            axios({
                url:'http://127.0.0.1:8000/workapp/user_put/',
                method:'put',
                data:form_data
            }).then(res=>{
                console.log(res.data)
            })
        }
    },
    created(){
        this.orderShow()
    }
}
</script>

<style>

</style>